<?php
/*****************
*作者：jeff.liu
*联系方式：13810908686
*电子邮件：ljf1279@yeah.net
******************/
class Field extends Object
{
	function __construct($arr = NULL)
	{
		parent::__construct($arr);
		if($this->TFName == '' && $this->FID > 0)
			$this->TFName = "Field_".$this->FID;
		if($this->TFType == '' && $this->FID > 0)
			$this->TFType = $this->getDefaultType();
		if($this->TID > 0)
		{
			$this->Template = new Template();
			$this->Template->getObjById($this->TID, "TID", "Template");
		}
		if(!$this->TFType)
		{
			if($this->FType == "Form::TextField")
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "200";
			}
			//文本域
			elseif($this->FType == "Form::TextArea")
			{
				$this->TFType = "TEXT";
				$this->FLength = "0";
			}
			//超文本域
			elseif($this->FType == "Form::FullTextArea")
			{
				$this->TFType = "LONGTEXT";
				$this->FLength = "0";
			}
			//密码框
			elseif($this->FType == "Form::PassWord")
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "200";
			}
			//单选
			elseif($this->FType == "Form::RadioGroup")
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "100";
			}
			//复选
			elseif($this->FType == "Form::CheckBoxGroup")
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "100";
			}
			//下拉列表
			elseif($this->FType == "Form::DropDownList")
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "100";
			}
			//图片框
			elseif($this->FType == "Form::Image")
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "200";
			}
			//相关发布
			elseif($this->FType == "Form::CrossPublish")
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "20";
			}
			else
			{
				$this->TFType = "VARCHAR";
				$this->FLength = "200";
			}
		}
	}

	function getDefaultType()
	{
		if($this->TFType == "Form::TextField")
		{
			
		}
		elseif($this->TFType == "Form::TextField")
		{
			
		}
	}

	function getInput()
	{
		/*
'Form::TextField', 'Form::TextArea', 'Form::PassWord', 'Form::RadioGroup', 'Form::CheckBoxGroup', 'Form::DropDownList', 'Form::Image', 'Form::CrossPublish', 'Application::SqlResult'
		*/
		$strReturn = "";
		//文本框
		if($this->FType == "Form::TextField")
		{
			$strReturn = "<input type=\"text\" name=\"{$this->TFName}\" value=\"<?php echo htmlspecialchars(\$Doc->{$this->TFName}); ?>\" id=\"FORM_FIELD_{$this->FID}\" style=\"display:;".($this->Width > 0?'width:'. $this->Width .'px;':'')."\" size=\"100\" />";
		}
		//文本域
		elseif($this->FType == "Form::TextArea")
		{
			$strReturn = "<textarea name=\"{$this->TFName}\" id=\"FORM_FIELD_{$this->FID}\" rows=\"15\" cols=\"75\" style=\"display:;".($this->Width > 0?'width:'. $this->Width .'px;':'')."".($this->Height > 0?'height:'. $this->Height .'px;':'')."\"><?php echo htmlspecialchars(\$Doc->{$this->TFName}); ?></textarea>";//<!--iframe  ID=\"eWebEditor{$this->FID}\" src=\"../eWebEditor/ewebeditor.php?style=standard&id={$this->TFName}\" width=\"600\" height=\"400\" scrolling=\"no\" frameborder=\"0\"></iframe-->";
/*			$strReturn = "<textarea name=\"{$this->TFName}\" id=\"FORM_FIELD_{$this->FID}\" rows=\"25\" cols=\"75\"><?php echo htmlspecialchars(\$Doc->{$this->TFName}); ?></textarea>";*/
		}
		//超文本域
		elseif($this->FType == "Form::FullTextArea")
		{
			$strReturn = '<?php $oFCKeditor = new FCKeditor("'.$this->TFName.'") ;
$oFCKeditor->BasePath = "../inc/" ;
$oFCKeditor->Height = '. ($this->Height > 0?$this->Height:600) . ' ;
$oFCKeditor->Value = $Doc->{'.$this->TFName.'};
$oFCKeditor->Create() ; ?' . '>';

			/*$strReturn = "<textarea name=\"{$this->TFName}\" id=\"FORM_FIELD_{$this->FID}\" rows=\"25\" cols=\"75\" style=\"display:\"><?php echo htmlspecialchars(\$Doc->{$this->TFName}); ?></textarea><!--iframe  ID=\"eWebEditor{$this->FID}\" src=\"../eWebEditor/ewebeditor.php?style=standard&id={$this->TFName}\" width=\"600\" height=\"400\" scrolling=\"no\" frameborder=\"0\"></iframe-->";*/
/*			$strReturn = "<textarea name=\"{$this->TFName}\" id=\"FORM_FIELD_{$this->FID}\" rows=\"25\" cols=\"75\"><?php echo htmlspecialchars(\$Doc->{$this->TFName}); ?></textarea>";*/
		}
		//密码框
		elseif($this->FType == "Form::PassWord")
		{
			$strReturn = "<input type=\"password\" name=\"{$this->TFName}\" value=\"<?php echo \$Doc->{$this->TFName}; ?>\" id=\"FORM_FIELD_{$this->FID}\">";
		}
		//单选
		elseif($this->FType == "Form::RadioGroup")
		{
			$code = $this->getFunction();
			if(eregi('select.+from', $code))
			{
				$sql = $this->explainSql($code);
				$strReturn .= '<?php $sql="'.$sql.'"; $list=execSql($sql); if($list){foreach($list as $option){if(!$option[1]){$option[1] = $option[0];}if(!$option[0]){$option[0] = $option[1];}echo "<input type=\"radio\" name=\"'.$this->TFName.'\" value=\"$option[1]\"";if($Doc->'.$this->TFName.'==$option[1]){echo " checked=\"checked\"";} echo " id=\"FORM_FIELD_'.$this->FID.'\" />$option[0] ";}} ?'.'>';
				/*
				$list = execSql($sql);
				if($list)
				{
					foreach ($list as $option)
					{
						if(!$option[1])
						{
							$option[1] = $option[0];
						}
						if(!$option[0])
						{
							$option[0] = $option[1];
						}
						$strReturn .= "<input type=\"radio\" name=\"{$this->TFName}\" value=\"$val\" <?php if(\$Doc->{$this->TFName}=='$option[1]') echo \" checked='checked'\"; ?> id=\"FORM_FIELD_{$this->FID}\">$option[0]";
					}
				}
				*/
			}
			else 
			{
				$list = split("\n",$code);
				foreach($list as $option)
				{
					if($option != '')
					{
						$option = ereg_replace("[\t\n\r]","",$option);
						list($key,$val) = split(",",$option);
						if(!isset($val))
						$val = $key;
						$strReturn .= "<input type=\"radio\" name=\"{$this->TFName}\" value=\"$val\" <?php if(\$Doc->{$this->TFName}=='$val') echo \" checked='checked'\"; ?> id=\"FORM_FIELD_{$this->FID}\">$key ";
					}
				}
			}
		}
		//复选
		elseif($this->FType == "Form::CheckBoxGroup")
		{
			$code = $this->getFunction();
			if(eregi('select.+from', $code))
			{
				$sql = $this->explainSql($code);
				$strReturn .= '<?php $sql="'.$sql.'"; $list=execSql($sql); if($list){foreach($list as $option){if(!$option[1]){$option[1] = $option[0];}if(!$option[0]){$option[0] = $option[1];}echo "<input type=\"checkbox\" name=\"'.$this->TFName.'[]\" value=\"$option[1]\"";if(strInList($option[1],$Doc->'.$this->TFName.')){echo " checked=\"checked\"";} echo " id=\"FORM_FIELD_'.$this->FID.'\" />$option[0] ";}} ?'.'>';
				/*
				$list = execSql($sql);
				if($list)
				{
					foreach ($list as $option)
					{
						if(!$option[1])
						{
							$option[1] = $option[0];
						}
						if(!$option[0])
						{
							$option[0] = $option[1];
						}
					$strReturn .= "<input type=\"checkbox\" name=\"{$this->TFName}[]\" value=\"$option[1]\" <?php if(strInList(\"$option[1]\",\$Doc->{$this->TFName})) echo \" checked='checked'\"; ?> id=\"FORM_FIELD_{$this->FID}\">$option[0]";
					}
				}
				*/
			}
			else 
			{
				$list = split("\n",$code);
				foreach($list as $option)
				{
					if($option != '')
					{
						$option = ereg_replace("[\t\n\r]","",$option);
						list($key,$val) = split(",",$option);
						if(!isset($val))
						$val = $key;
						$strReturn .= "<input type=\"checkbox\" name=\"{$this->TFName}[]\" value=\"$val\" <?php if(strInList(\"$val\",\$Doc->{$this->TFName})) echo \" checked='checked'\"; ?> id=\"FORM_FIELD_{$this->FID}\">$key ";
					}
				}
			}
		}
		//下拉列表
		elseif($this->FType == "Form::DropDownList")
		{
			$code = $this->getFunction();
			if(eregi('select.+from', $code))
			{
				$sql = $this->explainSql($code);
				$strReturn .= '<?php $sql="'.$sql.'"; $list=execSql($sql); if($list){if($list[0][0]){echo "<option></option>";}foreach($list as $option){if(!$option[1]){$option[1] = $option[0];}if(!$option[0]){$option[0] = $option[1];}echo "<option value=\"".$option[1]."\"";if($Doc->'.$this->TFName.'==$option[1]){echo " selected=\"selected\"";} echo " />$option[0]";}} ?'.'>';
/*				$list = execSql($sql);
				if($list)
				{
					if($list[0][0])
					{
						$strReturn .= "<option value=\"\"></option>";
						
					}
					foreach ($list as $option)
					{
						if(!$option[1])
						{
							$option[1] = $option[0];
						}
						if(!$option[0])
						{
							$option[0] = $option[1];
						}
						$strReturn .= "<option value=\"$option[1]\" <?php if(\$Doc->{$this->TFName}==\"$option[1]\") echo \" selected='selected'\"; ?>>$option[0]</option>";
					}
				}*/
			}
			else 
			{
				$list = split("\n",$code);
				foreach($list as $option)
				{
					if($option != '')
					{
						$option = ereg_replace("[\t\n\r]","",$option);
						list($key,$val) = split(",",$option);
						if(!isset($val))
						$val = $key;
						$strReturn .= "<option value=\"$val\" <?php if(\$Doc->{$this->TFName}==\"$val\") echo \" selected='selected'\"; ?>>$key</option>";
					}
				}
			}
			$strReturn = "<select name=\"{$this->TFName}\" id=\"FORM_FIELD_{$this->FID}\">$strReturn</select>";
		}
		//图片框
		elseif($this->FType == "Form::Image")
		{
			$strReturn = "<input type=\"text\" name=\"{$this->TFName}\" value=\"<?php echo \$Doc->{$this->TFName}; ?>\" id=\"{$this->TFName}\"><input type=\"button\" onclick=\"window.open('../upload.php?input={$this->TFName}','doUpload','width=300,height=200');\" value=\"上传图片\">";
			$strReturn .= "<a href='<?php echo eregi(\"^http:\/\/\",\$Doc->{$this->TFName})?\$Doc->{$this->TFName}:('".IMG_URL."/'.\$Doc->{$this->TFName}); ?>' target='_blank' id=\"link_{$this->TFName}\"><img src='<?php echo  eregi(\"^http:\/\/\",\$Doc->{$this->TFName})?\$Doc->{$this->TFName}:('".IMG_URL."/'.\$Doc->{$this->TFName}); ?>' height='20' border=0 id=\"img_{$this->TFName}\" /></a>";
			$strReturn .= "<input type=\"button\" name=\"ZOOM_{$this->TFName}\" onclick=\"window.open('../corpandresize/ui.php?'+document.getElementById('img_{$this->TFName}').src,'doUpload','width=700,height=500');\" value=\"裁剪图片\" />";
		}
		//相关发布
		elseif($this->FType == "Form::CrossPublish")
		{
		}
		//文本域
		elseif($this->FType == "Form::")
		{
		}
		return $strReturn;
	}

	//修改字段属性字符串
	function getChangeColumn($oldField, $action = "add")
	{
		//alter table '' change `` `` int() default ''
		$strReturn = "";
		if($this->TFName != $oldField->TFName || $this->TFType != $oldField->TFType || $this->FLength != $oldField->FLength || $action == "add")
		{
			if($action == "add")
			{
				$strReturn .= "ALTER TABLE `{$this->Template->DTName}` add column ";
			}
			else
			{
				$strReturn .= "ALTER TABLE `{$this->Template->DTName}` change column `{$oldField->TFName}` ";
			}
			$strReturn .= "`{$this->TFName}` {$this->TFType}";
			if($this->FLength > 0)
			$strReturn .= "($this->FLength)";
		}
		if($this->FIndex != $oldField->FIndex)
		{
			if($strReturn != "")
				$strReturn .= ";;;;;;;;;";
			if($this->FIndex == "INDEX")
				$strReturn .= $this->getAlterIndex();
			if($this->FIndex == "" && $action != "add")
				$strReturn .= $oldField->getAlterIndex("drop");
		}
		return $strReturn;
	}

	//
	function getAlterIndex($action = "add")
	{
		if($action == "add")
			return "ALTER TABLE `{$this->Template->DTName}` $action INDEX ( `{$this->TFName}` ) ";
		else
			return "ALTER TABLE `{$this->Template->DTName}` $action INDEX `{$this->TFName}` ";
	}
	//修改字段属性
	function updateColumn($oldField)
	{
		//alter table '' change `` `` int() default ''
		global $db;
		if($this->Depositing == 'Y' && $oldField->Depositing == 'N')
		{
			$strSql = $this->getChangeColumn($oldField,"add");
		}
		else
		{
			$strSql = $this->getChangeColumn($oldField,"");
		}
		
		if($strSql)
		{
			$arrSql = split(";;;;;;;;;",$strSql);
			if($arrSql)
			{
				foreach ($arrSql as $sql)
				{
//					echo $sql;
					$db->query($sql);
				}
			}
		}
	}
	//修改数据表
	function createColumn()
	{
		//alter table '' add column `` `` int() default ''
		global $db;
		if($this->Depositing == 'Y')
		{
			$strSql = $this->getChangeColumn(NULL,"add");
			$arrSql = split(";;;;;;;;;",$strSql);
			if($arrSql)
			{
				foreach ($arrSql as $sql)
				{
					//echo $sql;
					$db->query($sql);
				}
			}
		}
		$db->query("update Field set TFName=concat('Field_',FID) where FID='{$this->FID}'");
	}
	function explainSql($strSql)
	{//SELECT {},{},{}|* FROM {}[ WHERE {}='${}'[ AND {}='']][ GROUP BY {}][ ORDER BY {} [asc|desc]]
		if($strSql == '')
		{
			return false;
		}
		global $db;
		if(preg_match("/^[\\s]*select[\\s]+([^\\s]+)[\\s]+from[\\s]+([^\\s]+)[\\s]*(.*)$/is",$strSql, $matches))
		{//\\{([^\\}]+)\\}:\\{([^\\}]+)\\}([^\'\"]+)[\'\"](.*)[\'\"]
			list($line,$p_FNames,$p_TName,$p_Where) = $matches;
			$p_T = new Template();
			if(eregi("^\{[^\}\n\r\t ]+\}$",$p_TName))
			{
				$p_TName = ereg_replace("\{([^\}]+)\}","\\1",$p_TName);
				$p_T->getObjById($p_TName, 'TName', 'Template');
				if($p_T->TID > 0)
				{
					$strSql = ereg_replace("((from)|(FROM))[\n\r\t ]+(\{$p_TName\})",'FROM '.$p_T->DTName,$strSql);
				}
			}
			else
			{
				$p_T->getObjById($p_DTName, 'DTName', 'Template');
			}
			$p_TID = $p_T->TID;
			if($p_TID < 1)
			{
				return $strSql;
			}
			$p_DTName = $p_T->DTName;
			$p_TName = $p_T->TName;
			$arrFNames = split(',',$p_FNames);
			if($arrFNames)
			{
				foreach ($arrFNames as $FName) 
				{
					$sql = '';
					if(eregi('^\{[^\}]+\}$',$FName))
					{
						$FName = ereg_replace("\{([^\}]+)\}","\\1",$FName);
						$sql = "SELECT * FROM Field WHERE FName='$FName' and TID='$p_TID' limit 1";
						$result = $db->query($sql);
						if($row = $db->fetch_array($result))
						{
							$strSql = preg_replace('/select[\n\r\t ]+(.*)(\{'.$FName.'\})(.*)[\n\r\t ]+from/is','SELECT ${1}'.$row['TFName']."$3 FROM",$strSql);
						}
					}
				}
			}
			if($p_Where)
			{
				$Where = ereg_replace("where[\n\r\t ]+(.*)$","\\1",$p_Where);
				preg_match_all("/(\{[^\s]+\})/is",$Where,$rtn);
				if($rtn[1])
				{
					foreach ($rtn[1] as $FName)
					{
						$FName = ereg_replace('\{([^\}]+)\}',"\\1",$FName);
						$sql = "SELECT * FROM Field WHERE FName='$FName' and TID='$p_TID' limit 1";
						$result = $db->query($sql);
						if($row = $db->fetch_array($result))
						{
							$strSql = ereg_replace("where[\n\r\t ]+(.*)(\{$FName\})(.*)",'where \\1'.$row['TFName']."\\3 ",$strSql);
						}						
					}
				}
				//todo:
			}
		}
		return $strSql;
	}
	function add()
	{
		global $db;
		if($this->FName == "")
			return false;
		if(!$this->TID)
			return false;
//		$UID = $_SESSION['UID'];
//		if(!$UID)
//			return false;
/*
CREATE TABLE `field` (
  `FID`,  `TID`,  `FName`,  `TFName`,  `FType` ,  `TFType`,  `FLength`,  `FIndex`,  `Config`,  `UID`,  `CreateTime`,  `Depositing`,  `ProgramCode`,  `DefaultVal`
)
*/
		$sql = "insert into Field set 
		TID='{$this->TID}', FLength = '{$this->FLength}',FName = '{$this->FName}', TFName='{$this->TFName}', 
		`FType`='{$this->FType}', `TFType`='{$this->TFType}', `FPropty`='{$this->FPropty}', 
		`Width`='" . intval($this->Width) ."', `Height`='" . intval($this->Height) ."', 
		`ListOrder`='" . intval($this->ListOrder) ."' "
			.", `ExecOrder`='" . intval($this->ExecOrder) ."', `EditOrder`='" . intval($this->EditOrder) ."'"
			.", 
		`Config`='{$this->Config}', `Depositing`='{$this->Depositing}', `ProgramCode`='{$this->ProgramCode}', `DefaultVal`='{$this->DefaultVal}', CreateTime = '".time()."'";//--, UID = '$UID'
		if($db->query($sql))
		{
			$this->FID = $db->insert_id();
			$this->__construct($this);
			$this->createColumn();
			$this->Template->createAddDoc();
			return true;
		}
		return false;
	}

	function update()
	{
		global $db;
		if($this->FName == "")
			return false;
		$oldField = new Field();
		$oldField->getObjById($this->FID, "FID", "Field");
		$sql = "update Field set FName = '{$this->FName}', TFName='{$this->TFName}'"
			.", `FType`='{$this->FType}', `TFType`='{$this->TFType}'"
			.", `FPropty`='{$this->FPropty}', `FLength`='{$this->FLength}'"
			.", `FIndex`='{$this->FIndex}', `Config`='{$this->Config}'"
			.", `Depositing`='{$this->Depositing}', `ProgramCode`='{$this->ProgramCode}'"
			.", `DefaultVal`='{$this->DefaultVal}', `ListOrder`='" . intval($this->ListOrder) ."' "
			.", `ExecOrder`='" . intval($this->ExecOrder) ."', `EditOrder`='" . intval($this->EditOrder) ."'"
			.", `Height`='" . intval($this->Height) ."', `Width`='" . intval($this->Width) ."'"
			."where FID='{$this->FID}'";//DefaultVal
		if($db->query($sql))
		{
			//更新
			$this->updateColumn($oldField);
			$this->Template->createAddDoc();
			return true;
		}
		return false;
	}

	function delete()
	{
		
	}

	function getFunction()
	{
		global $db;
		$pCode = $this->ProgramCode;
		if($this->FType == "Application::SqlResult" || $this->FType == "Application::CrossPublish")
		{
			preg_match_all ("/\\$\{([^\s\}]+)\}/", $pCode, $matches);

			for ($i=0; $i< count($matches[0]); $i++) 
			{
				// "matched: ".$matches[0][$i]."\n";{DTName}
				// "part 1: ".$matches[1][$i]."\n";DTName
				//$matches[0][$i];
				$pCode = str_replace($matches[0][$i], "{\$Doc->".$matches[1][$i]."}", $pCode);
			}
			//$pCode = addslashes($pCode);
		}
		if($this->FType == "Application::CrossPublish")
		{
			$lines = split("\n",$pCode);
			$pCode = "";
			for($i=0; $i< count($lines); $i++)
			{
				$line = ereg_replace("[\n\r \t]","",$lines[$i]);
				$str = "";
//				if(!ereg("^[ \t]*\#",$line))
//				{
					if(preg_match("/^\\{([^\\}]+)\\}:\\{([^\\}]+)\\}([^\'\"]+)[\'\"](.*)[\'\"]$/is",$line, $matches))
					{
						list($line,$p_TName,$p_FName,$p_Op,$p_Val) = $matches;
						$p_Val = ereg_replace("\'","",$p_Val);
						$sql = "select TID,DTName from Template where TName = '{$p_TName}'";
						$result = $db->query($sql);
						if($row = $db->fetch_array($result))
						{
							$p_TID = $row[0];
							$p_DTName = $row[1];
							$sql = "select TFName from Field where TID='$p_TID' and FName = '$p_FName'";
							$result = $db->query($sql);
							if($row = $db->fetch_array($result))
							{
								$p_TFName = $row[0];
								$str .= ' $kjfadklafdjaskfreturn = "";';
								$str .= ' $sql="select D_ID from '.$p_DTName.' where '.$p_TFName.' '.$p_Op.' \''.$p_Val.'\'";';
								$str .= ' $result = $db->query($sql);';
								$str .= ' while($row = $db->fetch_array($result))';
								$str .= ' {';
								$str .= ' $kjfadklafdjaskfreturn .= ",".$row[0];';
								$str .= ' }';
								$str .= ' $kjfadklafdjaskfreturn = ereg_replace("^,","",$kjfadklafdjaskfreturn);';
								$str .= '';
								$str .= ' if($kjfadklafdjaskfreturn)echo "<script src=\'".BIN_URL."/docList_'.$p_TID.'.php?doPost=true&ID[]={$kjfadklafdjaskfreturn}&action=pub\'></script>";';
							}
						}
					}
//				}
				$pCode .= $str;
			}
		}
		return $pCode;
	}
}
/*
CREATE TABLE `Field` (
  `FID` int(11) NOT NULL auto_increment,
  `TID` int(11) NOT NULL default '0',
  `FName` varchar(255) NOT NULL default '',
  `TFName` varchar(255) NOT NULL default '',
  `FType` enum('Form::TextField','Form::TextArea','Form::PassWord','Form::RadioGroup','Form::CheckBoxGroup','Form::DropDownList','Form::Image','Form::CrossPublish','Application::SqlResult') NOT NULL default 'Form::TextField',
  `TFType` enum('','int','varchar','text','datetime','double','enum','longtext','float') NOT NULL default 'varchar',
  `FPropty` enum('','Title','Content','Channel','SubChannel','Pic','Author') default NULL,
  `FLength` int(4) NOT NULL default '0',
  `FIndex` enum('','PRIMARY','INDEX') NOT NULL default '',
  `Config` longtext,
  `UID` int(11) NOT NULL default '0',
  `CreateTime` int(11) NOT NULL default '0',
  `Depositing` enum('Y','N') NOT NULL default 'Y',
  `ProgramCode` longtext,
  `DefaultVal` longtext,
  `ListOrder` tinyint(4) NOT NULL default '0',
  `ExecOrder` tinyint(4) NOT NULL default '0',
  `EditOrder` tinyint(4) NOT NULL default '0',
  `Enable` enum('','Y','N') NOT NULL default 'Y',
  PRIMARY KEY  (`FID`),
  UNIQUE KEY `TID_2` (`TID`,`TFName`),
  KEY `TFName` (`TFName`),
  KEY `FName` (`FName`),
  KEY `FType` (`TFType`),
  KEY `CreateTime` (`CreateTime`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
*/
?>